﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.SessionState;
using System.Web.Routing;
using System.ServiceModel.Routing;
using System.ServiceModel.Activation;

namespace WcfRestfulTest
{
    public class Global : System.Web.HttpApplication
    {

        protected void Application_Start(object sender, EventArgs e)
        {
            RegisterRoutes();
        }

        private static void RegisterRoutes()
        {
            RouteTable.Routes.Add(new ServiceRoute("Service1", new WebServiceHostFactory(), GetServiceType("Service1")));
        }

        private static Type GetServiceType(string typeName)
        {
            string typeFullName = String.Format("WcfRestfulTest.{0},WcfRestfulTest", typeName);
            return Type.GetType(typeFullName);
        }

    }
}